feat(batch): async batch processing with worker pool (#11)#71
Merged
Conversation
Implements issue #11. Adds pkg/batch: - Processor: in-memory job queue backed by a configurable worker pool - Submit: enqueues a job, returns immediately with job_id - Get: returns current job state (queued/processing/completed/failed) - Results: returns deduplicated chunks + pipeline stats for completed jobs - List: filter jobs by status - evictLoop: removes completed/failed jobs after ResultTTL (default 24h) - Stop: graceful shutdown, drains in-flight jobs HTTP handlers live in cmd/api_pipeline.go (part of feat/4-pipeline). Co-authored-by: Ona <no-reply@ona.com>
3092083 to
fc7f82a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11
Summary
Adds
pkg/batch— an in-memory async job processor for large deduplication workloads.API
pkg/batchProcessor: configurable worker pool (default 4), job queue (default 1000), result TTL (default 24h)Submit: enqueues job, returns immediatelyGet: current job state (queued/processing/completed/failed)Results: deduplicated chunks + pipeline stats for completed jobsList(status): filter jobs by statusevictLoop: background goroutine removes expired results every 5 minutesStop: graceful shutdownHTTP handlers are in
cmd/api_pipeline.go(part of feat/4-pipeline).Files
pkg/batch/batch.gopkg/batch/batch_test.go— 7 tests